j3deditor.bin.hierarchy
Class J3DeCamera

java.lang.Object
  extended by j3deditor.bin.hierarchy.HierarchyNode
      extended by j3deditor.bin.hierarchy.J3DeCamera
All Implemented Interfaces:
J3DeSerializable, VirtualCamera

public class J3DeCamera
extends HierarchyNode
implements J3DeSerializable, VirtualCamera

Virtual camera that manages an instance of com.sun.j3d.utils.universe.ViewingPlatform bounded to this camera and manipulates its javax.media.j3d.TransformGroup object.

Author:
Risto Seene
See Also:
ViewingPlatform

Constructor Summary
J3DeCamera()
          Creates an instance of J3DeCamera.
 
Method Summary
 void moveFocus(float move1, float move2)
          Moves the virtual focus of the camera.
 void readData(java.io.InputStream in)
          Reads bytes from the given InputStream and tries to convert them to the attributes.
 void resetCameraPosition()
          Resets the position and orientation of this camera.
 void rotateCamera(float angle, float angleZ)
          Rotates the camera.
 void setCamera(com.sun.j3d.utils.universe.ViewingPlatform cam)
          Bounds the given ViewingPlatform to this virtual camera.
 void zoomCamera(float zoom)
          Zooms the camera in/out.
 void writeData(java.io.OutputStream out)
          Writes the camera attributes to the given OutputStream as byte arrays.
 
Methods inherited from class j3deditor.bin.hierarchy.HierarchyNode
clone, equals, getChild, getIndex, getIndexOfChild, getNumberOfChildren, getParent, getParent, getType, hasNamedChild, removeChild, setName, setParent, toString, updateName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

J3DeCamera

public J3DeCamera()
Creates an instance of J3DeCamera.

Method Detail

setCamera

public void setCamera(com.sun.j3d.utils.universe.ViewingPlatform cam)
Bounds the given ViewingPlatform to this virtual camera.

Parameters:
cam - ViewingPlatform to be bounded

moveFocus

public void moveFocus(float move1,
                      float move2)
Moves the virtual focus of the camera.

Specified by:
moveFocus in interface VirtualCamera
Parameters:
move1 - movement of the focus along the X-axis of the camera. Difference, not absolute position
move2 - movement of the focus along the Y-axis of the camera. Difference, not absolute position

zoomCamera

public void zoomCamera(float zoom)
Zooms the camera in/out.

Specified by:
zoomCamera in interface VirtualCamera
Parameters:
zoom - the amount to zoom

rotateCamera

public void rotateCamera(float angle,
                         float angleZ)
Rotates the camera.

Specified by:
rotateCamera in interface VirtualCamera
Parameters:
angle - rotation around the Y-axis of the scene. Difference, not absolute angle
angleZ - the change of the angle of the X-axis of camera. Difference, not absolute angle

writeData

public void writeData(java.io.OutputStream out)
               throws java.lang.Exception
Writes the camera attributes to the given OutputStream as byte arrays.

Specified by:
writeData in interface J3DeSerializable
Parameters:
out - stream to be written to
Throws:
java.lang.Exception - if unable to write to the given stream

readData

public void readData(java.io.InputStream in)
              throws java.lang.Exception
Reads bytes from the given InputStream and tries to convert them to the attributes.

Specified by:
readData in interface J3DeSerializable
Parameters:
in - stream to be read from
Throws:
java.lang.Exception - if unable to read from the given stream or unable to convert the byte arrays to attributes

resetCameraPosition

public void resetCameraPosition()
Resets the position and orientation of this camera.